package com.tt.dp.iterator;

import com.tt.dp.iterator.model.MenuItem;

import java.util.Iterator;
import java.util.List;

public class Waiter {

    private List<Menu<MenuItem>> menus;

    public Waiter(List<Menu<MenuItem>> menus) {
        this.menus = menus;
    }

    public void printMenu(){

        Iterator<Menu<MenuItem>> it = menus.iterator();

        while (it.hasNext()) {

            Menu<MenuItem> item = it.next();
            printItemByIterator(item.createIterator());
        }
    }

    private void printItemByIterator(Iterator<MenuItem> it){

        while (it.hasNext()){
            MenuItem item = it.next();

            System.out.println(item.toString());
        }
    }

    public void printBreakfastMenu(){

    }

    public void printLunchMenu(){

    }

    public void printVegetarianMenu(){

    }

    public boolean isItemVegetarian(String name){

        //指定名称的菜品，如果是素食则返回true
        return true;
    }
}
